package ioTest;

import java.io.*;

/**
 * 缓冲流实现文件的复制
 */
public class CopyDemo3Buffered {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("1_cp.jpg");//创建低级流
        BufferedOutputStream bos = new BufferedOutputStream(fos);//创建缓冲流
        FileInputStream fis = new FileInputStream("1111.jpg");
        BufferedInputStream bis = new BufferedInputStream(fis);
        //int a = bis.read();
        int a;
        while ((a=bis.read())!=-1){
            bos.write(a);
        }
        System.out.println("复制完成");
        bos.close();
        bis.close();//关闭流















    }
}
